package com.wc.alorithm_luogu.P4414;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/19 13:18
 * @description https://www.luogu.com.cn/problem/P4414
 * ABC
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // 相当于一种HashMap
        int[] letters = new int[128];

        int[] nums = new int[3];
        int n = 3;
        while (n-- > 0) {
            nums[n] = sc.nextInt();
        }
        Arrays.sort(nums);
        letters['A'] = nums[0];
        letters['B'] = nums[1];
        letters['C'] = nums[2];

        String s = sc.next();

        for (int i = 0; i < 3; i++) {
            if (i == 0) {
                System.out.print(letters[s.charAt(i)]);
            } else {
                System.out.print(" " + letters[s.charAt(i)]);
            }
        }
    }
}
